package com.kehutong.charge.dao;

import com.kehutong.charge.dto.ChargePenaltyOrderDTO;
import com.kehutong.charge.entity.ChargePenaltyOrder;
import org.coraframework.orm.annotation.Dao;
import org.coraframework.orm.annotation.Mapper;
import org.coraframework.orm.jdbc.Page;
import org.coraframework.orm.jdbc.execute.Condition;

import java.util.HashMap;
import java.util.List;

@Dao
public interface ChargePenaltyDao {



	@Mapper(
			genericType = HashMap.class,
			countSQL = "SELECT count(1) FROM(select communityNo from t_charge_penalty_order WHERE ${})a",
			sql= "SELECT residentsType,userName,houseNo,chargeAddress,communityNo,communityName,COUNT(1) penaltyOrderNumber,IFNULL(SUM(penaltyAmount),0.00) amountTotal " +
					"FROM t_charge_penalty_order WHERE ${}"
	)
	Page<ChargePenaltyOrderDTO> statistPage(Condition... condition);

	@Mapper(
			genericType = HashMap.class,
			sql= "SELECT houseNo,communityNo,IFNULL(SUM(penaltyAmount),0.00) penaltyAmount,IFNULL(SUM(payableAmount),0.00) payableAmount, IFNULL(SUM(paymentAmount),0.00) paymentAmount,IFNULL(SUM(negotiateAmount),0.00) negotiateAmount  FROM t_charge_penalty_order WHERE ${}"
	)
	List<ChargePenaltyOrder> findStatist(Condition... condition);

}
